package domd4;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        String str=input.nextLine();
       // 1.字符串分割
        String[] s1=str.split(" ");
      int len=s1[s1.length-1].length();
        System.out.println(len);
       // 2.
        int index=str.indexOf(" ");
        System.out.println(str.substring(index + 1).length());
    }
}
